package org.eddm.list;

import java.awt.Component;
import java.io.IOException;

import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;

public class EDDMListCellRender extends JPanel implements ListCellRenderer{
		
		private EDDMCellItem eddmCellItem;
		
		public EDDMListCellRender()  {
			setOpaque(true);			
			eddmCellItem = new EDDMCellItem();			
			add(eddmCellItem);
		}
	
		@Override
		public Component getListCellRendererComponent(JList arg0, Object arg1,
				int arg2, boolean arg3, boolean arg4) {
			
				try {
					eddmCellItem.setSvgUri((String)arg1);
					invalidate();
					return this;
				} catch (IOException e) {					
					e.printStackTrace();
				}
				
				return null;
		}		
}
